import { Navigate, RouteDefinition } from "@solidjs/router";
import ManageLayout from "../Layout/ManageLayout";
import UserList from "./User/List";
import { lazy } from "solid-js";

const ManageRoutes: RouteDefinition = {
    path: '/manage',
    component: ManageLayout,
    children: [
        {
            path: '/',
            component: () => Navigate({href: '/manage/overview'})
        },
        {
            path: '/overview',
            component: lazy(() => import('./Overview'))
        },
        {
            path: '/user',
            children: [
                {
                    path: '/',
                    component: () => Navigate({ href: '/manage/user/list' })
                },
                {
                    path: '/list',
                    component: lazy(() => import('./User/List'))
                }
            ],
        },
        {
            path: '/role',
            children: [
                {
                    path: '/',
                    component: () => Navigate({ href: '/manage/role/list' })
                },
                {
                    path: '/list',
                    component: lazy(() => import('./Role/List'))
                }
            ]
        }
    ]
}

export default ManageRoutes
